Skip to content

genie: return final summary text from _parse_attachments#443

Open
nisha2003 wants to merge 5 commits into
mainfrom
genie-final-summary-attachment
Open

genie: return final summary text from _parse_attachments#443
nisha2003 wants to merge 5 commits into
mainfrom
genie-final-summary-attachment

Conversation

@nisha2003

Copy link
Copy Markdown
Contributor

Summary

Genie.poll_for_result was surfacing only the trailing follow-up/clarifying question instead of the full answer for some Genie responses. _parse_attachments (since #419) picked the first text attachment following the last query, but internally-created messages emit a follow-up question text attachment before the final summary. The follow-up has an attachment_id; the final summary text attachment has no attachment_id.

This change makes _parse_attachments:

  • Drop text emitted strictly between the first and last query (superseded self-correction attempts), keeping leading and trailing text.
  • Among the kept text attachments, return the final summary — the text attachment without an attachment_id — falling back to the first kept text attachment when no id-less attachment is present.

Identifying the summary by the absence of attachment_id matches the agreed short-term approach from the incident discussion (the FinalSummaryAttachment is the only public-API attachment without an id).

Tests

  • Added a parametrized _parse_attachments case: follow-up question (with attachment_id) emitted before the id-less summary → the summary wins.
  • Full tests/databricks_ai_bridge/test_genie.py suite passes (75 passed).

Context: ES-1953657. Supersedes the concat-all approach in #432.

This pull request and its description were written by Isaac.

@nisha2003 nisha2003 requested a review from annzhang-db June 14, 2026 22:47
@jennsun

jennsun commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@nisha2003 the openai_test failures are known to be breaking on master but could you look into fixing the failures for Linting / typechecking for integrations/langchain (pull_request)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants